<template>
  <el-form
    :inline="true"
    :model="formInline"
    label-width="100px"
    class="el-form--inline certificateForm">
    <el-form-item label="注册证号">
      <el-input
        v-model="formInline.registrationNumber"
        placeholder="请输入注册证号"/>
    </el-form-item>

    <el-form-item label="注册人名称">
      <el-input
        v-model="formInline.registrantName"
        placeholder="请输入注册人名称"/>
    </el-form-item>

    <el-form-item label="产品名称(中)">
      <el-input
        v-model="formInline.productNameCN"
        placeholder="请输入注产品名称(中)"/>
    </el-form-item>

    <el-form-item label="产品名称(英)">
      <el-input
        v-model="formInline.productNameEN"
        placeholder="请输入注产品名称(英)"/>
    </el-form-item>

    <el-form-item label="代理人名称">
      <el-input
        v-model="formInline.agentName"
        placeholder="请输入注代理人名称"/>
    </el-form-item>

    <el-form-item label="状态">
      <el-select
        v-model="formInline.status"
        placeholder="请选择">
        <el-option
          v-for="item in options"
          :key="item.value"
          :label="item.label"
          :value="item.value"/>
      </el-select>
    </el-form-item>

    <el-form-item label="类型">
      <el-select
        v-model="formInline.type"
        placeholder="请选择">
        <el-option
          v-for="item in typeOptions"
          :key="item.value"
          :label="item.label"
          :value="item.value"/>
      </el-select>
    </el-form-item>

    <el-form-item
      label="有效期至"
      class="certificateFormDataPicker">
      <el-date-picker
        v-model="formInline.expireDateStart"
        type="date"
        placeholder="开始日期"/>
      -
      <el-date-picker
        v-model="formInline.expireDateEnd"
        type="date"
        placeholder="结束日期"/>
    </el-form-item>

    <el-form-item
      label="创建时间"
      class="certificateFormDataPicker">
      <el-date-picker
        v-model="formInline.addTimeStart"
        type="date"
        placeholder="开始日期"/>
      -
      <el-date-picker
        v-model="formInline.addTimeEnd"
        type="date"
        placeholder="结束日期"/>
    </el-form-item>

    <el-form-item class="searchButtonList">
      <el-button
        class="submit"
        @click.stop="serach">查询</el-button>
      <el-button
        class="reset"
        @click.stop="reset">重置</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  name: 'SearchForm',
  data () {
    return {
      formInline: {
        registrationNumber: null,
        registrantName: null,
        productNameCN: null,
        productNameEN: null,
        agentName: null,
        status: null,
        expireDateStart: null,
        expireDateEnd: null,
        type: null,
        addTimeStart: null,
        addTimeEnd: null
      },
      options: [{
        value: '1',
        label: '有效'
      }, {
        value: '2',
        label: '无效'
      }],
      typeOptions: [{
        value: '1',
        label: '国产'
      }, {
        value: '2',
        label: '进口'
      }],
      value: ''
    }
  },
  methods: {
    serach () {
      this.$emit('searchForm', this.formInline)
    },
    reset () {
      this.formInline = {
        registrationNumber: null,
        registrantName: null,
        productNameCN: null,
        productNameEN: null,
        agentName: null,
        status: null,
        expireDateStart: null,
        expireDateEnd: null,
        type: null,
        addTimeStart: null,
        addTimeEnd: null
      }
      this.$emit('resetForm', this.formInline)
    }
  }
}
</script>

<style lang="less">
    .certificateForm .el-form-item {
      margin-right: 16px;
      margin-bottom: 16px;
    }

    .certificateForm .el-input__inner {
      border-radius: 0 !important;
      height: 34px;
      line-height: 34px;
      width: 211px;
    }

    .certificateForm .el-form-item__label {
      padding-right: 10px;
    }

    .certificateFormDataPicker .el-date-editor.el-input,
    .certificateFormDataPicker .el-input__inner {
      width: 140px;
    }
</style>
<style scoped>
    .searchButtonList button {
      width: 74px;
      height: 34px;
      cursor: pointer;
      margin-left: 10px;
    }

    .submit {
      background: rgba(35, 113, 197, 1);
      border: 0;
      color: #fff;
    }

    .reset {
      background: rgba(255, 255, 255, 1);
      border: 1px solid rgba(221, 223, 225, 1);
    }
</style>
